import { request } from "@/utils/service"
import type {
  getOrganizationListResponseData,
  addOrganizationResponseData,
  addOrganizationRequestData,
  getOrganizationPageListResponseData
} from "./types/organization"

/**获取全部机构列表 */
export function getOrganizationList() {
  return request<getOrganizationListResponseData>({
    url: "crm/organization",
    method: "get"
  })
}

/**获取分页机构列表 */
export function getOrganizationPageList(params?: { pageSize?: number; page?: number }) {
  return request<getOrganizationPageListResponseData>({
    url: "crm/organization/list",
    method: "get",
    params
  })
}

/**添加机构 */
export function addOrganization(data: addOrganizationRequestData) {
  return request<addOrganizationResponseData>({
    url: "crm/organization",
    method: "post",
    data
  })
}
